{% extends 'layout.html' %}

{% block title %}
    管理员列表
{% endblock title %}

{% block content %}
    <div class="container">

        {# 新建 搜索部分 #}
        <nav class="navbar navbar-default">
            <div class="container-fluid">
                <div class="navbar-header">
                    {#新建按钮#}
                    <a class="btn btn-success navbar-btn" href="/admin/add/">
                        <span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span>
                        新建管理员
                    </a>
                </div>

                {# 搜索部分 #}
                <div style="float: right">
                    <form class="navbar-form navbar-left">
                        <div class="form-group">
                            <input type="text" class="form-control " placeholder="关键字" name="q"
                                   value="{{ search_data }}">
                        </div>
                        <button type="submit" class="btn btn-default">
                            <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
                            查找
                        </button>
                    </form>
                </div>
            </div>
        </nav>

        {#面板#}
        <div class="panel panel-default">
            <!-- Default panel contents -->
            <div class="panel-heading">
                <span class="glyphicon glyphicon-th-list" aria-hidden="true"></span>
                管理员列表
            </div>

            <!-- Table -->
            <table class="table table-bordered table-striped table-hover">
                <thead>
                <tr>
                    <th>序号</th>
                    <th>ID</th>
                    <th>用户名</th>
                    <th>密码</th>
                    <th>重置密码</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                {% for obj in queryset %}
                    <tr>
                        <th>{{ forloop.counter }}</th>
                        <td>{{ obj.id }}</td>
                        <td>{{ obj.username }}</td>
                        <td>******</td>
                        <td><a href="/admin/{{ obj.id }}/reset/">重置密码</a></td>
                        <td>
                            <a href="/admin/{{ obj.id }}/edit" class="btn btn-primary btn-xs">编辑</a>
                            <a href="/admin/{{ obj.id }}/delete" class="btn btn-danger btn-xs">删除</a>
                        </td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        </div>

        {# 分页 #}
        <ul class='pagination'>
            {{ page_string }}
        </ul>

    </div>
{% endblock content %}